class Author < ActiveRecord::Base
    has_many :books
    validates_associated :books
    validates_presence_of   :name
    validates_length_of     :name, :minimum => 4,   :message => "Name must be longer than 4 characters"
    validates_uniqueness_of :name ,:case_sensitive => false, :message => "Name already exists!"
    validates_acceptance_of :accepts, accept: "1"
    validates_format_of     :email, :with => /([^@s]+)@((?:[-a-z0-9]+)\.[a-z]{2,})/i
    #validates_presence_of   :foo
    validates_confirmation_of  :foo
    #validates_presence_of   :foo_confirmation
end
